<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
</head>
<body>
	<canvas id="canvas" width="500" height="500" style="border: 1px solid #ccc;"></canvas>

</body>
</html>

<script type="text/javascript">
	var canvas = document.getElementById('canvas');
	var context = canvas.getContext('2d');
	var buffer = new Image();
	buffer.src='images/butterfly.png';
	buffer.onload= drawBuffer;

	function drawBuffer(){
		context.drawImage(buffer,0,0,200,138,0,0,200,138);
		//1个蝴蝶
		context.drawImage(buffer,0,0,200,138,200,0,200,138);
     	//改了横坐标
     	context.drawImage(buffer,0,0,200,138,400,0,200,138);
     	setTimeout(function({
     		context.clearRect(0,0,600,500);
     		context.drawImage(buffer,0,0,200,138,0,0,200,138);
     		context.drawImage(buffer,0,0,200,138,200,200,200,138);
     	    context.drawImage(buffer,0,0,200,138,0,0,200,138);
     	},1000)
	}

</script>